package com.io;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.util.Scanner;

public class ByteArrayInputOutputStreamDemo01 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入数据: ");
        String msg = sc.nextLine();
        ByteArrayInputStream bain=new ByteArrayInputStream(msg.getBytes());
        ByteArrayOutputStream baout=new ByteArrayOutputStream();
        //bain每次读一个字节放入c,再将c写入baout

        int c=-1;
//        while((c=bain.read())!=-1) {
//            baout.write(c);
//        }
        System.out.println(bain.read());
        baout.write(97);
        System.out.println("baout = " + baout);
    }
}
